<?php

namespace app\admin\validate;
use think\Validate;

class user extends Validate
{
    protected $rule = [
        'username'=>'require|max:11|phone|unique:user',
        'password'=>'require|password|confirm:password2',
        'email'=>'require|email',
    ];
    protected $message = [
        'username.require'=>'请输入用户名',
        'username.max'=>'手机号不能超过11位',
        'username.phone'=>'手机号格式不正确1',
        'username.unique'=>'手机号已存在',
        'password.require'=>'请输入密码',
        'password.confirm'=>'两次密码不一致',
        'password.password'=>'密码长度不能超过32位低于6位',
        'email.require'=>'邮箱不能为空',
        'email.email'=>'邮箱格式不正确',
    ];

    protected $regex = [
        'phone'    => '/^1[3-8]{1}[0-9]{9}$/',
        'password'  => '/^[\w]{6,32}$/'
    ];
}